﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Entities.Admin;

namespace WindowsForms.Admin
{
    public partial class FormListTaiKhoan : Form
    {
        public FormListTaiKhoan()
        {
            InitializeComponent();
            dataGridViewtk.AutoGenerateColumns = false;
        }

        private void tsblrefersh_Click(object sender, EventArgs e)
        {
            LoadTaiKhoan(TaiKhoan.Objects.All().ToList());

        }
        private void LoadTaiKhoan(List<TaiKhoan> ds)
        {
            dataGridViewtk.DataSource = ds;
        }

        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Bitmap bm = new Bitmap(this.dataGridViewtk.Width, this.dataGridViewtk.Height);
            dataGridViewtk.DrawToBitmap(bm, new Rectangle(0, 0, this.dataGridViewtk.Width, this.dataGridViewtk.Height));
            e.Graphics.DrawImage(bm, 0, 0);
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            printDocument1.Print();
        }
    }
}
